package com.jason.www.state_pattern.template;

/**
 * 上下文环境
 */
public class Context {

    /**
     * 维护一个State状态实例
     */
    private State state;

    public Context(State state){
        this.state = state;
    }

    public void setState(State state){
        this.state = state;
    }

    public State getState(){
        return state;
    }

    public void handle(){
        state.handle(this);
    }
}
